package com.directv.z8training.ex7;

/**
 * @author HieuLT8
 *
 */
public class Person1 implements Comparable<Person1> {
	
	protected String name;
	protected String address;
	protected int age;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	/**
	 * @param name
	 * @param address
	 * @param age
	 */
	public Person1(String name, String address, int age) {
		this.name = name;
		this.address = address;
		this.age = age;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof Person1)) {
			return false;
		}

		Person1 other = (Person1) obj;
		return this.name.equals(other.name);
	}

	@Override
	public int hashCode() {
		return this.name.hashCode();
	}

	@Override
	public int compareTo(Person1 o) {
		return o.name.compareTo(this.name);
	}
}
